class Solution(object):
    def intersection(self, nums1, nums2):
        """
        :type nums1: List[int]
        :type nums2: List[int]
        :rtype: List[int]
        """
        hast_set = set(nums1)
        res = set()
        for num in nums2:
            if num in hast_set:
                res.add(num)
        return list(res)
        # 法二：
        # return list(set(nums1) & set(nums2))
if __name__ == '__main__':
    nums1 = [1,2,2,1]
    nums2 = [2,2]
    print(Solution().intersection(nums1, nums2))